﻿<!DOCTYPE html>
@{
    if (false)
    {
        <script src="~/LiberUI/Scripts/jquery.js"></script>
        <script src="~/LiberUI/Scripts/jquery.ba-resize.js"></script>
        <script src="~/LiberUI/Scripts/LiberUI.Base.js"></script>
        <script src="~/LiberUI/Scripts/LiberUI.Controllers.js"></script>
        <script src="~/LiberUI/Scripts/LiberUI.Action.js"></script>
    }
}
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @System.Web.Optimization.Styles.Render("~/cssBase")
    @System.Web.Optimization.Scripts.Render("~/jsBase")
    <link href="~/SiteUI/Base.css" rel="stylesheet" />
    <link href="~/SiteUI/DetailBase.css" rel="stylesheet" />
</head>
<body>
    @*定义一个容纳当前页面各种UI部件和数据的环境变量*@
    <script>
        Env = {};
    </script>
    <div id="Wnd">
        <div id="page">
            <div id="HeadBar">
                @RenderSection("HeadBar", false)
                <div id="UserBar">
                    <div id="Avata">您好！@ViewBag.UserName</div>
                    <div id="MyMessage">消息</div>
                    <div id="MyAlert">提醒</div>
                </div>
            </div>
            <div id="LeftNavi">
                <div id="pnlSideBar">
                    @RenderSection("SideBar", false)
                </div>
            </div>
            <div id="Main">
                @RenderBody()
            </div>
            <div id="PageHelper">
                <a id="GoTop" class="hideOut"></a>
                @RenderSection("PageHelper", false)
            </div>
            <div class="floatClear"></div>
        </div>
    </div>
    <script>
        function fixIt(ev) {
            if (this.Offset().top >= Env.DyHeight) {
                //当Position改为fixed需要加上右侧滚动条的宽度
                Env.HeadBar.css('top', '0px').css('position', 'fixed').css('paddingRight', '14px');
                if (Env.GoTop.hasClass("hideOut")) {
                    Env.GoTop.removeClass("hideOut").addClass("hideIn");
                }
            }
            else {
                Env.HeadBar.css('position', '').css('top', '').css('paddingRight', '');
                if (Env.GoTop.hasClass("hideIn")) {
                    Env.GoTop.removeClass("hideIn").addClass("hideOut");
                }
            }
        };
        
        $(function () {
            $.ajaxSetup({ global: true });

            //计算页面头部各种布局数据，实现页面头部及左侧区域的悬浮效果
            Env.DyHeight = 1;
            Env.HeadBar = $("#HeadBar");

            //创建滚动条控件
            Env.scl = new Scroller($('#page'));
            Env.scl.on('scrolling', fixIt);

            Env.sclLeft = new Scroller($('#pnlSideBar'));

            //创建GoTop按钮
            Env.GoTop = $("#GoTop").click(function () { Env.scl.val({ 'ScrollTop': 0 }); });
        })
    </script>
</body>
</html>
